import request from '@/router/axios';

//生成订单编码
export const getOrderNumber = (orderType) => {
  return request({
    url: 'api/stockOrder/getOrderNumber',
    method: 'get',
    params: {
      orderType
    }
  })
}
//供应商-下拉选项
export const getListSupplier = () => {
  return request({
    url: 'api/select/listSupplier',
    method: 'get',
    params: {}
  })
}
//物品类型 -下拉選項
export const listGoodsType = (goodsCategory) => {
  return request({
    url: '/api/select/listGoodsType?goodsCategory='+goodsCategory,
    method: 'get'
  })
}
//品牌 -下拉選項
export const listBrand = () => {
  return request({
    url: '/api/select/listBrand',
    method: 'get'
  })
}
//规格型号 -下拉選項
export const listSpec = (typeId) => {
  return request({
    url: '/api/select/listSpec?typeId='+typeId,
    method: 'get'
  })
}
//配置 -下拉選項
export const listConfig = (typeId) => {
  return request({
    url: '/api/select/listConfig?typeId='+typeId,
    method: 'get'
  })
}

//资产分类 -下拉選項
export const listTreeAssetInformation = (params) => {
  return request({
    url: '/api/select/listTreeAssetInformation',
    method: 'get',
    params:params
  })
}


//单位 -下拉選項
export const listUnit = () => {
  return request({
    url: '/api/select/listUnit',
    method: 'get'
  })
}
//存放位置 -下拉選項
export const listStock = (params) => {
  return request({
    url: '/api/select/listStock',
    method: 'get',
    params:params
  })
}
//所属部门-下拉選項（后期去掉，用selectDepartment）
export const getAll = () => {
  return request({
    url: 'api/select/listDept',
    method: 'get',
    params: {}
  })
}
//所属部门-下拉選項
export const selectDepartment = () => {
  return request({
    url: 'api/select/listDept',
    method: 'get',
    params: {}
  })
}
//员工-下拉選項
export const getStaff = () => {
  return request({
    url: 'api/select/listStaff',
    method: 'get',
    params: {}
  })
}
//字典表
export const getDictionary = (code) => {
  return request({
    url: 'api/blade-system/dict-biz/dictionary?code='+'month_time',
    method: 'get',
    params: {}
  })
}

//仓库-下拉選項
export const getListStock = () => {
  return request({
    url: 'api/select/listStock',
    method: 'get',
    params: {}
  })
}
//退货原因-下拉選項
export const getReturnReason = () => {
  return request({
    url: 'api/blade-system/dict-biz/dictionary?code='+'return_cause',
    method: 'get',
    params: {}
  })
}
//报废原因-下拉選項
export const getScrapReason = () => {
  return request({
    url: 'api/blade-system/dict-biz/dictionary?code='+'scrap_cause',
    method: 'get',
    params: {}
  })
}
//時間-下拉選項
export const getTime = () => {
  return request({
    url: 'api/blade-system/dict-biz/dictionary?code='+'month_time',
    method: 'get',
    params: {}
  })
}
//处置方-下拉选项
export const getListHandler = () => {
  return request({
    url: 'api/select/listHandler',
    method: 'get',
    params: {}
  })
}
//规格型号-下拉选项
export const getListSpec = (params) => {
  return request({
    url: 'api/select/listSpec',
    method: 'get',
    params: params
  })
}
//品牌-下拉选项
export const getListBrand = () => {
  return request({
    url: 'api/select/listBrand',
    method: 'get',
    params: {}
  })
}
//配置-下拉选项
export const getListConfig = () => {
  return request({
    url: 'api/select/listConfig',
    method: 'get',
    params: {}
  })
}
//物品类型-下拉选项
export const getGoodsType = (goodsCategory) => {
  return request({
    url: '/api/select/listGoodsType?goodsCategory='+goodsCategory,
    method: 'get'
  })
}
//使用状态-下拉選項
export const getGoodsState = () => {
  return request({
    url: 'api/blade-system/dict-biz/dictionary?code='+'goods_status',
    method: 'get',
    params: {}
  })
}
//调出-接收位置-下拉選項
export const getDepartmentTree = () => {
  return request({
    url: 'api/select/listTreeStock',
    method: 'get',
    params: {}
  })
}
//部门-使用人-下拉選項
export const getListTreeStaff = () => {
  return request({
    url: 'api/select/listTreeStaff?isHasAsset=true',
    method: 'get',
    params: {}
  })
}


//上级分类-下拉選項
export const getTopTypeName = (params) => {
  return request({
    url: 'api/select/listTreeAssetInformation',
    method: 'get',
    params: params
  })
}
//根据部门id查询员工-下拉選項
export const getStaffByDeptId = (deptId) => {
  return request({
    url: 'api/select/listStaff?deptId='+deptId,
    method: 'get',
    params: {}
  })
}
//根据部门id查询存放位置 -下拉選項
export const flistStockByDeptId = (deptId) => {
  return request({
    url: '/api/select/listStock?deptId='+deptId,
    method: 'get'
  })
}
//根据部门id查询使用人-退库
export const withDrawalByDeptId = (deptId) =>{
  return request({
    url:'/api/select/listStaffByHasAsset?deptId='+deptId,
    method: 'get'
  })
}
